/*
 * Created on 08/23/2011 - 04:00 AM
 */

package sembr.geometry.interfacing;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Adriano
 */
abstract public class Shape<E> implements IDataAttribute
{
    protected List<E> elements;
    
    public Shape()
    {
        elements = new ArrayList<E>();
    }
    
    protected void add(E element)
    {
        elements.add(element);
    }
    
    public List<E> getElements()
    {        
        return elements;
    }    
    
    public E getCurrentElement(int index)
    {
        if (elements.isEmpty())
            throw new EmptyShapeException();
        
        return elements.get(index);
    }
    
    public int length()
    {
        return elements.size();
    }      
    
    @Override
    abstract public int[] getColor(int index);
}
